﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.IO;

namespace Framework
{
    class Util
    {
        public static Label CreateLabel(string name,string text,Font font,Color backColor,Color foreColor,Size size,Point location)
        {
            Label lbl = new Label();
            lbl.Text = text;
            lbl.Font = font;
            lbl.BackColor = backColor;
            lbl.ForeColor = foreColor;
            lbl.Size = size;
            lbl.Location = location;
            return lbl;
        }
        public static TextBox CreateTextBox(string name,Font font, Size size, Point location)
        {
            TextBox txt = new TextBox();
            txt.Name = name;
            txt.AutoSize = false;
            txt.Font = font;
            txt.Size = size;
            txt.Location = location;
            txt.BorderStyle = BorderStyle.None;
            return txt;
        }
        public static PictureBox CreatePictureBox(string name,Image img,Color backgroundColor,Size size,Point location)
        {
            PictureBox ptx = new PictureBox();
            ptx.Name = name;
            ptx.BackgroundImage = img;
            ptx.BackColor = backgroundColor;
            ptx.Size = size;
            ptx.Location = location;
            ptx.BackgroundImageLayout = ImageLayout.Stretch;
            return ptx;
        }

        public static Button CreateButton(string name,string text, Image bgImg, Size size, Point location)
        {
            Button btn = new Button();
            btn.Name = name;
            btn.Text = text;
            btn.BackgroundImage = bgImg;
            btn.Size = size;
            btn.Location = location;
            btn.BackgroundImageLayout = ImageLayout.Stretch;
            return btn;
        }

        public static Panel CreatePanel(string name, Image bgImg, Size size, Point location)
        {
            Panel pnl = new Panel();
            pnl.Name = name;
            pnl.BackgroundImage = bgImg;
            pnl.Size = size;
            pnl.Location = location;
            pnl.BackgroundImageLayout = ImageLayout.Stretch;
            return pnl;
        }

        public static GroupBox CreateGroupBox(string name, string text,Font font, Size size, Point location)
        {
            GroupBox gtx = new GroupBox();
            gtx.Name = name;
            gtx.Text = text;
            gtx.Font = font;
            gtx.Size = size;
            gtx.Location = location;

            return gtx;
        }
        public static List<string> ReadFile(string filename)
        {
            List<string> list_temp = new List<string>();
            StreamReader srd = new StreamReader(filename);
            string line = "";
            while ((line = srd.ReadLine()) != null)
            {
                list_temp.Add(line);
            }
            return list_temp;
        }
    }
}
